We need to be efficient as the gas rate consumed needs to be low and
precise when we develop smart contracts, i.e., it is public 24/ 7 hour once
you deploy the smart contract, and it cannot be changed.
pragma solidity ^0.5.0;
Code with constructor and public visibility
contract P ink
{
string public message;
constructor() public
{
message = "Namaste Jaipur! ";
}
function set(string memory _message) public
{
message = _message;
}
}
OpCode
Let us understand OpCode, considering the following smart contract:
pragma solidity ^ 0.5.0;
contract E x
{
uint a = 100 + 500;
}
The byte code generated for the above smart contract is:
0:
0x6080604052600f600055348015601457600080fd5b50603e806022600039
6000f3fe6080604052600080fdfea265627a7a72315820d744d36b3a0d1d4d
9d29fec51d0cc40d22d969ea444ccccae7395dd44a1d480464736f6c634300
05110032
OpCode explanation:
PU SH1 0× 60 means putting a 1-byte value of “0× 60” in the stack.
Coincidentally, the hexadecimal value for PU SH1 happens to be “0× 60” as